<template>
	<view class="content">
		<div class="flex flex-direction justify-center">
			<u-loading-icon mode="semicircle" size="40" color="#34A76C" :border-width="4"></u-loading-icon>
			<div class="fontS28 mt-20 text-center">切换身份中...</div>


		</div>
	</view>
</template>

<script>
import { getTIMUserID } from "../../utils/tim/helper";

export default {
	data() {
		return {


		};
	},
	computed: {
		userInfo() {
			return this.$store.getters.userInfo;
		},
	},



	async onLoad(option) {
		if (option.userType) {
			let userInfo = { ...this.userInfo };
			userInfo.userType = option.userType
			this.$store.commit("SET_USERINFO", userInfo);
      const _userID = getTIMUserID(userInfo.userId, userInfo.userType)
      console.log('_userID--->', _userID, this.$store.state.tim.isReady)
      this.$chat.logout().then(() => {
        this.$chat.login(_userID);
      });
		}
		setTimeout(() => {
			uni.switchTab({
				url: '/pages/home/home'
			})
		}, 3000);

	},


	methods: {



	},
};
</script>

<style lang="less" scoped>
page {
	background-color: #f7f7f7 !important;
}

.content {
	height: 100vh;
	overflow: hidden;

	&>div {
		width: 100%;
		height: 100%;
	}


}

::v-deep .u-loading-icon__spinner--semicircle {
	border-width: 4px !important;
}
</style>
